package easy

import (
	. "GoLeetcode/common"
)

func hasPathSum(root *TreeNode, targetSum int) bool {
	if root == nil {
		return true
	}
	nextTarget := targetSum - root.Val
	return hasPathSum(root.Left, nextTarget) || hasPathSum(root.Right, nextTarget)
}
